Skip to content

added test if messurement of BME280Sensor was successfull fixes #11301 - #11302

Open
mcenderdragon wants to merge 3 commits into
meshtastic:developfrom
mcenderdragon:patch-1
Open

added test if messurement of BME280Sensor was successfull fixes #11301#11302
mcenderdragon wants to merge 3 commits into
meshtastic:developfrom
mcenderdragon:patch-1

Conversation

@mcenderdragon

@mcenderdragon mcenderdragon commented Jul 31, 2026

Copy link
Copy Markdown

See issue #11301

I will test around if this fixes that issue, overall I think testing if the meassurment is successfull is needed. Also will need to test if millis() even works on the nRF or if the timeout never fires.

🤝 Attestations

  • I have tested that my proposed changes behave as described.
  • I have tested that my proposed changes do not cause any obvious regressions on the following devices:
    • Heltec (Lora32) V3
    • LilyGo T-Deck
    • LilyGo T-Beam
    • RAK WisBlock 4631
    • Seeed Studio T-1000E tracker card
    • Other (please specify below)
    • Heltec T114

Summary by CodeRabbit

  • Bug Fixes
    • Improved sensor reliability by adding an I2C communication timeout.
    • Added automatic sensor recovery and a retry when measurements fail.
    • Ensured sensor metrics are reported only when valid readings are available.
    • Added error logging when recovery or subsequent measurements remain unsuccessful.

@CLAassistant

CLAassistant commented Jul 31, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 755334ea-9a92-4034-aa50-928de9931c14

📥 Commits

Reviewing files that changed from the base of the PR and between ed13900 and f3ee461.

📒 Files selected for processing (1)
  • src/modules/Telemetry/Sensor/BME280Sensor.cpp
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/modules/Telemetry/Sensor/BME280Sensor.cpp

📝 Walkthrough

Walkthrough

BME280 initialization sets a 50 ms I2C timeout and forced-mode sampling configuration. Metric collection reads data only after successful measurements. Failed measurements trigger reinitialization and one retry.

Changes

BME280 measurement recovery

Layer / File(s) Summary
Sensor setup and data extraction
src/modules/Telemetry/Sensor/BME280Sensor.cpp
A shared helper configures forced-mode sampling. Initialization sets the I2C timeout and applies the configuration. Metric reads set presence flags only after successful reads.
Measurement validation and recovery
src/modules/Telemetry/Sensor/BME280Sensor.cpp
getMetrics validates forced measurements, reinitializes the sensor after failure, retries once, and logs recovery or repeated failure outcomes.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested labels: hardware-support, needs-review

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title identifies the BME280 measurement success check and references the related issue, despite spelling errors.
Description check ✅ Passed The description explains the purpose and references issue #11301, but the testing attestations remain unchecked.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

@mcenderdragon, Welcome to Meshtastic!

Thanks for opening your first pull request. We really appreciate it.

We discuss work as a team in discord, please join us in the #firmware channel.
There's a big backlog of patches at the moment. If you have time,
please help us with some code review and testing of other PRs!

Welcome to the team 😄

@mcenderdragon
mcenderdragon marked this pull request as ready for review August 2, 2026 18:42

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (1)
src/modules/Telemetry/Sensor/BME280Sensor.cpp (1)

22-26: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Extract the duplicated setSampling(...) call into a helper.

The same setSampling(...) call, with identical arguments, appears in initDevice (lines 22-26) and again in getMetrics (lines 49-53). Extract it into a small helper to avoid the two call sites drifting apart over time.

♻️ Proposed helper extraction
+static void configureBME280Sampling(Adafruit_BME280 &sensor)
+{
+    sensor.setSampling(Adafruit_BME280::MODE_FORCED,
+                        Adafruit_BME280::SAMPLING_X1, // Temp. oversampling
+                        Adafruit_BME280::SAMPLING_X1, // Pressure oversampling
+                        Adafruit_BME280::SAMPLING_X1, // Humidity oversampling
+                        Adafruit_BME280::FILTER_OFF, Adafruit_BME280::STANDBY_MS_1000);
+}
+
 bool BME280Sensor::initDevice(TwoWire *bus, ScanI2C::FoundDevice *dev)
 {
     bus->setTimeout(50);
     LOG_INFO("Init sensor: %s", sensorName);
     status = bme280.begin(dev->address.address, bus);
     if (!status) {
         return status;
     }
 
-    bme280.setSampling(Adafruit_BME280::MODE_FORCED,
-                       Adafruit_BME280::SAMPLING_X1, // Temp. oversampling
-                       Adafruit_BME280::SAMPLING_X1, // Pressure oversampling
-                       Adafruit_BME280::SAMPLING_X1, // Humidity oversampling
-                       Adafruit_BME280::FILTER_OFF, Adafruit_BME280::STANDBY_MS_1000);
+    configureBME280Sampling(bme280);
 
     initI2CSensor();
     return status;
 }

And in getMetrics, replace the second setSampling(...) block with configureBME280Sampling(bme280);.

Also applies to: 49-53

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/modules/Telemetry/Sensor/BME280Sensor.cpp` around lines 22 - 26, Extract
the identical sampling configuration from initDevice and getMetrics into a
shared configureBME280Sampling helper, then replace both setSampling call sites
with that helper while preserving the existing arguments and behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/modules/Telemetry/Sensor/BME280Sensor.cpp`:
- Line 46: Correct the “meassurment” typo to “measurement” in both warning log
messages within the BME280 sensor measurement/reset handling, including the
message near the related line, without changing their logging behavior.
- Around line 34-71: Update BME280Sensor::getMetrics to return true only when
either the initial or recovery takeForcedMeasurement succeeds, and return false
when both attempts fail so EnvironmentTelemetryModule does not mark invalid
metrics as valid. Also add an else branch for a failed bme280.init() recovery
that logs the reinitialization failure before returning false.
- Line 15: Remove the bus->setTimeout(50) call from the BME280 sensor
initialization; do not replace it with a generic I2C timeout mechanism, and only
add platform-specific timeout handling if an appropriate API and units are
available.

---

Nitpick comments:
In `@src/modules/Telemetry/Sensor/BME280Sensor.cpp`:
- Around line 22-26: Extract the identical sampling configuration from
initDevice and getMetrics into a shared configureBME280Sampling helper, then
replace both setSampling call sites with that helper while preserving the
existing arguments and behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 9a04d9ed-4dab-4a6b-ab1b-bd1ba7d51c17

📥 Commits

Reviewing files that changed from the base of the PR and between e2460b5 and ed13900.

📒 Files selected for processing (1)
  • src/modules/Telemetry/Sensor/BME280Sensor.cpp


bool BME280Sensor::initDevice(TwoWire *bus, ScanI2C::FoundDevice *dev)
{
bus->setTimeout(50);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🌐 Web query:

Does TwoWire::setTimeout on ESP32 and nRF52 (Adafruit nRF52 core / mbed) map to Stream::setTimeout or to an I2C hardware timeout like setWireTimeout?

💡 Result:

The TwoWire::setTimeout method on ESP32 does not map to Stream::setTimeout, nor is it equivalent to setWireTimeout as used in other Arduino cores. On the ESP32 (Arduino ESP32 core), TwoWire::setTimeout is a custom, ESP32-specific API [1]. It is used to set the timeout in milliseconds for I2C transactions, which is then passed directly to the low-level i2cWrite function [2][3]. It is not related to the Stream class's setTimeout, which typically handles serial communication timing. The setWireTimeout method, which is commonly associated with the AVR and certain other cores (like Renesas) to manage I2C hardware bus lockups and timeouts, is generally not implemented in the ESP32 core under that name [4][5][6]. While the goal of the ESP32's setTimeOut is to provide a transaction-level timeout to avoid blocking, it operates independently of the setWireTimeout API found in other ecosystems [1][2]. Regarding the Adafruit nRF52 core (based on mbed), it does not natively implement setWireTimeout or the ESP32's setTimeOut as a standard feature across all boards [7][5]. The Wire library API can vary significantly between different hardware cores in the Arduino ecosystem, as there is no single, unified standard for I2C timeout configuration across all platforms [4][5]. In summary: 1. ESP32's setTimeOut is a unique, platform-specific function that controls I2C transaction duration in milliseconds [1][2]. 2. It does not interface with Stream::setTimeout [2]. 3. It is not equivalent to the setWireTimeout method found in other Arduino cores [4][5]. For cross-platform code, you cannot rely on either setWireTimeout or setTimeout to consistently provide I2C hardware timeout functionality [5].

Citations:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== Candidate file =="
fd -a 'BME280Sensor.cpp' . || true

echo "== File excerpt =="
if [ -f src/modules/Telemetry/Sensor/BME280Sensor.cpp ]; then
  cat -n src/modules/Telemetry/Sensor/BME280Sensor.cpp | sed -n '1,110p'
fi

echo "== Repository Wire/TwoWire declarations =="
rg -n "class TwoWire|struct TwoWire|setTimeout|setWireTimeout|setTimeOut" -S . -g '*.h' -g '*.hpp' -g '*.cpp' | head -200

echo "== Relevant I2C bus initialization / Platform-specific APIs =="
rg -n "Wire\.(setTimeout|setWireTimeout|setTimeOut)|setTimeOut\(|setTimeout\(" . -g '*.cpp' -g '*.h' -g '*.hpp' | head -200

Repository: meshtastic/firmware

Length of output: 7655


🌐 Web query:

nRF52 Adafruit TwoWire setTimeout function definition Stream.hpp inherits setTimeout

💡 Result:

In the Adafruit nRF52 Arduino core, the TwoWire class (defined in Wire.h) inherits from the Stream class [1][2]. Because the Stream class provides the setTimeout method, the TwoWire class technically inherits this function [3][4]. However, there is no specific definition or implementation of setTimeout within the TwoWire class itself in the Adafruit nRF52 library [1][5][6]. Furthermore, the TwoWire implementation for nRF52 does not utilize the Stream-based timeout functionality for its I2C operations (such as endTransmission or requestFrom) [7]. Technical findings: 1. Inheritance: TwoWire inherits from Stream, which makes setTimeout available as part of the public interface [1][2]. 2. Implementation: The TwoWire class does not override or implement its own setTimeout function [1][2]. 3. Functional Status: Users have reported that the nRF52 Wire library lacks timeout handling in its I2C communication methods, meaning that if an I2C device stalls or hangs the bus, calls to functions like endTransmission may block indefinitely because they do not implement or check for the Stream-defined timeout [7].

Citations:


🌐 Web query:

Adafruit nRF52 TwoWire stream setTimeout I2C requestFrom timeout

💡 Result:

In the Adafruit nRF52 Arduino core, the TwoWire implementation does not support a software-based timeout mechanism for I2C transactions [1]. Unlike some other Arduino cores (such as AVR) that implement setWireTimeout to recover from bus hangs [2][3][4], the Adafruit nRF52 Wire library lacks this functionality [1][5][6]. Technical details: 1. Blocking Behavior: The TwoWire::requestFrom and endTransmission functions in the nRF52 core are blocking [1][5][6]. They utilize while loops to poll hardware event registers (e.g., EVENTS_RXSTARTED, EVENTS_LASTRX, EVENTS_STOPPED) [5][6]. 2. Lack of Timeout: If an I2C device fails to respond, NACKs, or holds the bus in a way that prevents these hardware events from triggering, the code will remain stuck in these while loops indefinitely [1][7]. 3. No setWireTimeout: The setWireTimeout function available in other Arduino cores is not part of the standard Adafruit nRF52 Wire library API [8][2]. Users experiencing hangs due to unresponsive I2C devices will find that the system does not automatically recover [1]. Workarounds and Recommendations: * Hardware Reliability: Since software recovery is unavailable, ensure physical I2C bus integrity. This includes using correct pull-up resistors and addressing signal noise, which are common causes of hangs on the nRF52 [1]. * External Watchdog: Using the internal nRF52 Watchdog Timer (WDT) is the most robust way to recover the system if an I2C hang occurs. You can configure the WDT to reset the microcontroller if the main loop stops responding due to an I2C block. * Custom Implementation: While advanced users could theoretically attempt to modify Wire_nRF52.cpp to add timeout checks based on a timer or micros [1], this requires custom firmware builds and is not a standard supported feature.

Citations:


🌐 Web query:

mbed Wire TwoWire setTimeout nRF52

💡 Result:

The class TwoWire does not consistently implement a universal setWireTimeout method across all Mbed-enabled or Arduino-based nRF52 platforms [1][2]. In the context of the Mbed OS nRF52 HAL (Hardware Abstraction Layer), timeout management for I2C (TWI) operations is handled internally by the driver rather than through a public TwoWire method [3]. Historically, issues with I2C "hanging" on nRF52 due to clock stretching or bus errors have been managed by modifying internal timeout values within the driver's C source code (e.g., i2c_api.c), often involving the use of microsecond tickers to monitor transaction duration [4][5][3][6]. If you are using the Arduino framework on an nRF52 (such as the Adafruit nRF52 board support package), the Wire library may lack a setWireTimeout() method [2], which is commonly found in other architectures like AVR [7] or ESP32 [8]. Because implementation varies by the specific board support package (BSP) and Mbed OS version, you should check the following: 1. Check for library-specific methods: Some variants of the Wire library may implement setTimeout(ms) [8], but this is not guaranteed for all nRF52 cores [1][2]. 2. Consult the underlying HAL: If your application hangs during I2C, it is often due to the driver entering an infinite loop while waiting for hardware events (like STOP or RX/TX) [2]. On Mbed-based platforms, ensure you are using a recent version of the OS, as many I2C driver instabilities regarding timeouts and clock stretching have been addressed in later releases [6][9]. 3. Manual Timeout: If the library lacks an API to set a timeout, you may need to implement a "watchdog" approach or use a non-blocking I2C wrapper if available, or verify your hardware pull-up resistors to prevent bus lockup conditions [2]. In summary, there is no standardized setWireTimeout API for TwoWire on nRF52; reliance on driver-level internal timeouts or higher-level application logic is generally required [3][2].

Citations:


🌐 Web query:

Adafruit nRF52 TwoWire setTimeout function definition Stream.hpp inherits setTimeout

💡 Result:

In the Adafruit nRF52 Arduino core, the TwoWire class inherits from the Arduino Stream class [1][2]. The Stream class provides the setTimeout(unsigned long timeout) method [3][4][5], which sets the maximum time, in milliseconds, that the stream will wait for data [6]. However, for the TwoWire class in the Adafruit nRF52 implementation, the setTimeout method from the Stream class is intended for stream-based reading operations (e.g., read, peek) [3][6]. It does not provide I2C bus timeout functionality for methods like endTransmission or requestFrom [7]. Because the TwoWire implementation in this core lacks specific I2C timeout mechanisms, these I2C functions can hang if the bus or target device experiences issues [7]. To clarify: 1. Inheritance: TwoWire inherits from Stream [1][2], so it technically has access to the setTimeout function inherited from the base class [3][6]. 2. Functionality: This setTimeout function affects operations that use the stream-based read/peek logic [6] and does not control the low-level TWI/I2C communication timing [7]. 3. I2C Timeouts: The Adafruit nRF52 TwoWire class does not implement a setWireTimeout function or similar I2C-specific timeout control, which is a known limitation when compared to some other Arduino cores [7][8].

Citations:


Remove the non-portable I2C timeout call.

bus->setTimeout(50) is not a portable I2C hang-protection call. On the nRF54L15 platform in this repository, TwoWire::setTimeout() is an empty stub, so this call does nothing. On core variants where it is inherited from Stream, it affects stream-read helpers instead of requestFrom()/endTransmission(). If I2C timeout behavior is required, gate it behind platform-specific APIs and use the correct timeout type/units for each implementation.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/modules/Telemetry/Sensor/BME280Sensor.cpp` at line 15, Remove the
bus->setTimeout(50) call from the BME280 sensor initialization; do not replace
it with a generic I2C timeout mechanism, and only add platform-specific timeout
handling if an appropriate API and units are available.

Comment thread src/modules/Telemetry/Sensor/BME280Sensor.cpp
Comment thread src/modules/Telemetry/Sensor/BME280Sensor.cpp Outdated
@mcenderdragon

mcenderdragon commented Aug 2, 2026

Copy link
Copy Markdown
Author

@coderabbitai please check if now all is resolved.

@coderabbitai

coderabbitai Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- Changed files and diff ---'
git diff --find-renames origin/main...HEAD -- src/modules/Telemetry/Sensor/BME280Sensor.cpp

printf '%s\n' '--- BME280Sensor.cpp outline ---'
ast-grep outline src/modules/Telemetry/Sensor/BME280Sensor.cpp --items all

printf '%s\n' '--- Pull request review comments ---'
gh api repos/meshtastic/firmware/pulls/11302/comments \
  --paginate \
  --jq '.[] | {id, user: .user.login, path, line, body, created_at, in_reply_to_id}'

Length of output: 886


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- Pull request metadata ---'
gh pr view 11302 --repo meshtastic/firmware \
  --json baseRefName,headRefName,commits,reviewThreads \
  --jq '{baseRefName, headRefName, commits: [.commits[] | {oid, messageHeadline}], reviewThreads: [.reviewThreads[] | {isResolved, comments: [.comments[] | {author: .author.login, path, line, body}]}]}'

printf '%s\n' '--- Current BME280Sensor.cpp ---'
ast-grep outline src/modules/Telemetry/Sensor/BME280Sensor.cpp --items all
nl -ba src/modules/Telemetry/Sensor/BME280Sensor.cpp | sed -n '1,280p'

printf '%s\n' '--- GitHub review comments ---'
gh api repos/meshtastic/firmware/pulls/11302/comments \
  --paginate \
  --jq '.[] | {id, user: .user.login, path, line, body, created_at, in_reply_to_id}'

printf '%s\n' '--- GitHub PR diff ---'
gh api -H 'Accept: application/vnd.github.diff' repos/meshtastic/firmware/pulls/11302

Length of output: 1921


🏁 Script executed:

#!/bin/bash
set -u

printf '%s\n' '--- Pull request metadata ---'
gh pr view 11302 --repo meshtastic/firmware \
  --json baseRefName,headRefName,commits,reviewDecision,mergeable \
  --jq '{baseRefName, headRefName, reviewDecision, mergeable, commits: [.commits[] | {oid, messageHeadline}]}' \
  || true

printf '%s\n' '--- BME280Sensor.cpp structure and content ---'
ast-grep outline src/modules/Telemetry/Sensor/BME280Sensor.cpp --items all || true
nl -ba src/modules/Telemetry/Sensor/BME280Sensor.cpp | sed -n '1,320p' || true

printf '%s\n' '--- Pull request review comments ---'
gh api repos/meshtastic/firmware/pulls/11302/comments \
  --paginate \
  --jq '.[] | {id, user: .user.login, path, line, body, created_at, in_reply_to_id}' \
  || true

printf '%s\n' '--- Pull request review threads ---'
gh api graphql \
  -F owner='meshtastic' \
  -F name='firmware' \
  -F number=11302 \
  -f query='
query($owner: String!, $name: String!, $number: Int!) {
  repository(owner: $owner, name: $name) {
    pullRequest(number: $number) {
      reviewThreads(first: 100) {
        nodes {
          isResolved
          path
          line
          comments(first: 20) {
            nodes {
              author { login }
              body
              createdAt
            }
          }
        }
      }
    }
  }
}' \
  --jq '.data.repository.pullRequest.reviewThreads.nodes' \
  || true

printf '%s\n' '--- Pull request diff ---'
gh api -H 'Accept: application/vnd.github.diff' repos/meshtastic/firmware/pulls/11302 \
  || true

Length of output: 59224


@mcenderdragon, not all findings are resolved.

Resolved:

  • BME280Sensor::getMetrics() now returns false after a failed reinitialization or retry.
  • The recovery failure is logged.
  • The measurement log-message spelling is corrected.

Still unresolved:

  • src/modules/Telemetry/Sensor/BME280Sensor.cpp still calls bus->setTimeout(50).
  • This call is not portable I2C timeout protection. On some supported targets, it has no effect on blocking I2C operations.

Please remove this generic timeout call unless the code uses a supported, platform-specific I2C timeout API.

You are interacting with an AI system.

@coderabbitai

coderabbitai Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '=== Changed files and diff ==='
git diff --find-renames origin/"$(git remote show origin | sed -n '/HEAD branch/s/.*: //p')"...HEAD -- src/modules/Telemetry/Sensor/BME280Sensor.cpp || true

echo '=== BME280Sensor.cpp outline ==='
ast-grep outline src/modules/Telemetry/Sensor/BME280Sensor.cpp --items all --view expanded || true

echo '=== BME280Sensor.cpp ==='
cat -n src/modules/Telemetry/Sensor/BME280Sensor.cpp

echo '=== Declaration candidates ==='
fd -i 'BME280Sensor*' . -t f -x sh -c 'echo "--- $1"; ast-grep outline "$1" --items all --view expanded; cat -n "$1"' sh {} || true

echo '=== Related measurement/retry/timeout usages and tests ==='
rg -n -i -C 3 \
  '(BME280Sensor|performReading|takeForcedMeasurement|setTimeout|Wire\.setTimeOut|measurement.*success|BME280)' \
  -g '!src/modules/Telemetry/Sensor/BME280Sensor.cpp' \
  -g '*test*' -g '*Test*' -g '*.cpp' -g '*.h' -g '*.hpp' .

Length of output: 35139


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '=== Pull request changed-file summary ==='
git diff --stat "$(git merge-base origin/$(git remote show origin | sed -n '/HEAD branch/s/.*: //p') HEAD)" HEAD
git diff --name-status "$(git merge-base origin/$(git remote show origin | sed -n '/HEAD branch/s/.*: //p') HEAD)" HEAD

echo '=== I2C class declarations and timeout methods ==='
rg -n -i -C 5 \
  '(class\s+TwoWire\b|struct\s+TwoWire\b|setTime(out|Out)\s*\(|setTime(out|Out)\s*\()' \
  src variants -g '*.h' -g '*.hpp' -g '*.cpp' || true

echo '=== Platform configuration relevant to nRF and I2C ==='
fd -t f -e h -e hpp -e cpp -e ini . src/platform variants \
  | xargs -r rg -n -i -C 3 '(TwoWire|setTime(out|Out)|Wire\.|i2c.*timeout|nrf54)' || true

echo '=== Test directories and BME280-related test references ==='
fd -t d -i 'test*' . -E .git -E .pio -E build || true
rg -n -i -C 3 'BME280(Sensor)?|takeForcedMeasurement' \
  -g '*test*' -g '*Test*' -g '*.cpp' -g '*.h' -g '*.hpp' . || true

Length of output: 130197


@mcenderdragon No. One blocking issue remains.

BME280Sensor.cpp Line 24 calls bus->setTimeout(50). The repository’s nRF54L15 TwoWire implementation in src/platform/nrf54l15/Wire.h does not declare setTimeout. A build that includes BME280 support on this platform will fail.

The measurement failure handling is otherwise improved. The code retries after a failed forced measurement and sets metric presence flags only after a successful read.

Please use an I2C timeout API that is supported on all target platforms, or add an equivalent TwoWire::setTimeout implementation for nRF54L15.

You are interacting with an AI system.

@mcenderdragon

Copy link
Copy Markdown
Author

Update: T114 did hang mid blink, and no different log output aka it hangs durign the takeForcedMeassurement Call. Only a hardware watchdog can probaply fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants